package controllers;

import play.mvc.Controller;
import play.mvc.Result;

public class Root extends Controller {

	public static Result page(String language, String page) {
		Result ret = null;

		if (!langs.Langs.langExists(language)) {
			ret = notFound("page not found");
		} else {
			if ("index".equals(page)) {
				ret = ok(views.html.index.render(language));
			} else {
				ret = notFound("page not found");
			}
		}

		return ret;
	}

	public static Result redirect_index(String language) {
		return redirect("/" + language + "/index");
	}

	public static Result redirect_page(String language, String page, String whatever) {
		return redirect("/" + language + "/" + page);
	}
}
